/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ucb.ProjetoFinal.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author DCBorges
 */
@Entity
@Table(name = "sdctb022_perfil")
public class Perfil implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "CO_PERFIL")
    private Integer coPerfil;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "DE_PERFIL")
    private String dePerfil;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "coPerfil")
    private List<Usuario> usuarioList;

    public Perfil() {
    }

    public Perfil(Integer coPerfil) {
        this.coPerfil = coPerfil;
    }

    public Perfil(Integer coPerfil, String dePerfil) {
        this.coPerfil = coPerfil;
        this.dePerfil = dePerfil;
    }

    public Integer getCoPerfil() {
        return coPerfil;
    }

    public void setCoPerfil(Integer coPerfil) {
        this.coPerfil = coPerfil;
    }

    public String getDePerfil() {
        return dePerfil;
    }

    public void setDePerfil(String dePerfil) {
        this.dePerfil = dePerfil;
    }

    public List<Usuario> getUsuarioList() {
        return usuarioList;
    }

    public void setUsuarioList(List<Usuario> usuarioList) {
        this.usuarioList = usuarioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (coPerfil != null ? coPerfil.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Perfil)) {
            return false;
        }
        Perfil other = (Perfil) object;
        if ((this.coPerfil == null && other.coPerfil != null) || (this.coPerfil != null && !this.coPerfil.equals(other.coPerfil))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.ucb.ProjetoFinal.domain.Perfil[ coPerfil=" + coPerfil + " ]";
    }
    
}
